---------------------------
-- Default awesome theme --
---------------------------

local theme_assets = require('beautiful.theme_assets')
local xresources = require('beautiful.xresources')
local dpi = xresources.apply_dpi

local gshape = require('gears.shape')
local gfs = require('gears.filesystem')
local themes_path = gfs.get_themes_dir()

local theme = {}

local colors = {
    dark = '#272e33',
    gray = '#475258',
    light = '#d3c6aa',
    green = '#97f060',
    yellow = '#dbdc5f',
    red = '#f65e30',
    green_bg = '#97f06090',
    yellow_bg = '#dbdc5f90',
    red_bg = '#f65e3090',
    -- green_bg = '#67b030',
    -- yellow_bg = '#abac3f',
    -- red_bg = '#c63e10',
}

local font = {}

do
    local font_faces = {main = 'IBM Plex Mono'}
    for key, face in pairs(font_faces) do
        font[key] = function(size) return face..' '..tostring(size) end
    end
end

theme.font          = font.main(10)
theme.thin_border   = dpi(1)
theme.thin_margin   = dpi(2)
theme.light_margin  = dpi(3)

theme.bg_normal     = colors.dark
theme.bg_hover      = colors.gray
theme.bg_focus      = colors.light
theme.bg_urgent     = colors.red
theme.bg_minimize   = colors.gray
theme.bg_systray    = theme.bg_normal

theme.battery_width      = dpi(40)
theme.battery_green      = colors.green
theme.battery_yellow     = colors.yellow
theme.battery_red        = colors.red
theme.battery_green_bg   = colors.green_bg
theme.battery_yellow_bg  = colors.yellow_bg
theme.battery_red_bg     = colors.red_bg
theme.battery_chr_font   = font.main(9)
theme.battery_label_font = font.main(8)

theme.fg_normal     = colors.light
theme.fg_focus      = colors.dark
theme.fg_urgent     = colors.dark
theme.fg_minimize   = colors.light

theme.useless_gap    = dpi(5)
theme.useless_margin = theme.useless_gap*2
theme.border_width   = 0
theme.border_radius  = theme.light_margin*2+theme.thin_margin+theme.thin_border
theme.border_normal  = colors.gray
theme.border_focus   = colors.light
theme.border_marked  = colors.green

local function rounded_rect(radius)
    return function(cr, w, h)
        return gshape.rounded_rect(cr, w, h, radius)
    end
end

theme.shape = {
    rect = gshape.rectangle,
    rounded = rounded_rect(theme.border_radius),
    rounded_small = rounded_rect(theme.border_radius*.5),
    rounded_tiny = rounded_rect(theme.border_radius*.33),
}

theme.shape.default = theme.shape.rect

theme.bar_height = dpi(28) + theme.useless_gap*2 + theme.thin_margin*2
theme.wibar_shape = theme.shape.rounded
theme.wibar_border_color = colors.gray
theme.wibar_border_width = theme.thin_border

-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- tasklist_[bg|fg]_[focus|urgent]
theme.tasklist_shape = theme.shape.rounded_small
theme.tasklist_shape_border_width = theme.thin_border
theme.tasklist_shape_border_color_focus = colors.light
theme.tasklist_shape_border_color = colors.gray
theme.tasklist_spacing = theme.light_margin
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- Example:
--theme.taglist_bg_focus = '#ff0000'
theme.taglist_spacing = theme.light_margin
theme.taglist_shape = theme.shape.rounded_small
theme.taglist_fg_empty = colors.gray
theme.taglist_bg_occupied = colors.gray
theme.taglist_fg_occupied = colors.light
theme.taglist_shape_border_width = theme.thin_border
theme.taglist_shape_border_color = colors.gray
theme.taglist_shape_border_color_focus = colors.light

-- Generate taglist squares:
local taglist_square_size = dpi(0)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
    taglist_square_size, theme.bg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
    taglist_square_size, theme.fg_normal
)

-- Variables set for theming notifications:
-- notification_font
-- notification_[bg|fg]
-- notification_[width|height|margin]
-- notification_[border_color|border_width|shape|opacity]

-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_submenu_icon = themes_path..'default/submenu.png'
theme.menu_height = dpi(15)
theme.menu_width  = dpi(100)

theme.wallpaper = gfs.get_xdg_config_home()..'assets/bg.jpg'

-- You can use your own layout icons like this:
theme.layout_fairh = themes_path..'default/layouts/fairhw.png'
theme.layout_fairv = themes_path..'default/layouts/fairvw.png'
theme.layout_floating  = themes_path..'default/layouts/floatingw.png'
theme.layout_magnifier = themes_path..'default/layouts/magnifierw.png'
theme.layout_max = themes_path..'default/layouts/maxw.png'
theme.layout_fullscreen = themes_path..'default/layouts/fullscreenw.png'
theme.layout_tilebottom = themes_path..'default/layouts/tilebottomw.png'
theme.layout_tileleft   = themes_path..'default/layouts/tileleftw.png'
theme.layout_tile = themes_path..'default/layouts/tilew.png'
theme.layout_tiletop = themes_path..'default/layouts/tiletopw.png'
theme.layout_spiral  = themes_path..'default/layouts/spiralw.png'
theme.layout_dwindle = themes_path..'default/layouts/dwindlew.png'
theme.layout_cornernw = themes_path..'default/layouts/cornernww.png'
theme.layout_cornerne = themes_path..'default/layouts/cornernew.png'
theme.layout_cornersw = themes_path..'default/layouts/cornersww.png'
theme.layout_cornerse = themes_path..'default/layouts/cornersew.png'

-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil

return theme

-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
